package com.github.gaojh.mvc.websocket;

import com.github.gaojh.server.handler.WebSocketAdapter;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author gaojh
 * @since 2020/3/26
 */
public class WebSocketContext {
    private static Map<String, WebSocketAdapter> webSocketAdapterMap = new ConcurrentHashMap<>();

    public static void addWebSocketAdapter(String url,WebSocketAdapter webSocketAdapter){
        webSocketAdapterMap.put(url, webSocketAdapter);
    }

    public static WebSocketAdapter getWebSocketAdapter(String url){
        return webSocketAdapterMap.get(url);
    }
}
